package br.com.empresa.controller;

import java.io.IOException;

import javax.swing.JOptionPane;

import br.com.empresa.app.Principal;
import br.com.empresa.dao.AlunoDao;
import br.com.empresa.modelo.Aluno;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

public class AlunoController {
    @FXML
    private TextField txTelefone;

    @FXML
    private TextField txturma;

    @FXML
    private Button btVoltar;

    @FXML
    private Button btEdit;

    @FXML
    private Button btExcluir;

    @FXML
    private TextField txendereco;

    @FXML
    private TextField txCodigo;

    @FXML
    private Button btSalvar;

    @FXML
    private TextField txidade;

    @FXML
    private TextField txNome;

    @FXML
    private TextField txcpf;

    @FXML
    private TextField txrg;

    @FXML
    void eventVoltar(ActionEvent event) {
    	try{
	    	Parent root = FXMLLoader.load(getClass().getResource("/br/com/empresa/view/principal.fxml"));	  
	    	Principal.SCENE.setRoot(root);
	    	}catch(IOException ex){
	    		ex.printStackTrace();
	    		
	    	}	

    }
    
    @FXML
    void eventSalvar(ActionEvent event) {
     	Aluno a = new Aluno();
     	a.setNome(txNome.getText());
     	a.setCpf(txcpf.getText());
     	a.setEndereco(txendereco.getText());  
      	AlunoDao dao = new AlunoDao();
	   	dao.inserir(a);    	

        
     	
	 
    }
	

}
